package commands.creator
import utils.GenericSyntaxParser;

import org.groovymud.object.alive.Player;

def stream = source.getTerminalOutput()
source = (Player) source
if(args == null){
	stream.writeln "Usage: dest objectname [index]"
}
GenericSyntaxParser parser = new GenericSyntaxParser()
parser.parse(argstr, "in")
def container = registry
if(parser.prepositionObject?.objectName == "me"){
	container = source
}
if(parser.prepositionObject?.objectName == "here"){
	container = source.currentContainer
}
def objToDest = parser.subjectObject.findObjectInContainer(container)

if(objToDest != null){
	if(objToDest instanceof Set){
		objToDest.each{
			registry.dest(it, true)
		}
	}else{
		registry.dest(objToDest, true)
	}
}else{
	stream.writeln "Cannot find a ${argstr} to dest"
}